<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search" Title="Asah Consulting - Search" %>
<%@ Reference Control="~/App_Common/UserControls/CrumbNavigation.ascx" %>

<asp:Content ID="cntMain" ContentPlaceHolderID="cphZone1" runat="Server">
    <div>
        <table cellspacing="0" cellpadding="0" width="90%">
            <tr>
                <td width="571" height="16">
                    Advanced Search:
                </td>
            </tr>
            <tr>
                <td width="571">
                    <asp:Panel runat="server" ID="pnlAdvSearch" DefaultButton="btnAdvSearch"><asp:TextBox ID="txtSearch" runat="server" CssClass="Textbox"></asp:TextBox>&nbsp;<asp:Button runat="server" ID="btnAdvSearch" Text="Search" /></asp:Panel></td>
            </tr>
            <tr>
                <td valign="top" width="571" height="34">
                    Search On :
                    <asp:RadioButton ID="AllWords" runat="server" GroupName="mode" Checked="True" Text="All Words ">
                    </asp:RadioButton>
                    <asp:RadioButton ID="AnyWords" runat="server" GroupName="mode" Text="Any Words "></asp:RadioButton>
                    <asp:RadioButton ID="Phrase" runat="server" GroupName="mode" Text="Phrase"></asp:RadioButton></td>
            </tr>
        </table>
        <asp:Panel ID="pnlProductSearchResults" runat="server" Visible="False">
            <h3>
                Product Search Results</h3>
            <table class="SearchStatus" id="Table3" cellspacing="1" cellpadding="1" width="100%"
                align="center" border="0">
                <tr>
                    <td style="height: 18px;">
                        Searched the site for
                        <asp:Label ID="lblProductSearchWords" runat="server" Font-Bold="True"></asp:Label>.&nbsp;&nbsp;&nbsp;
                        <asp:Label ID="lblProductsFound" runat="server" Font-Bold="True"></asp:Label>&nbsp;Products
                        found
                    </td>
                </tr>
            </table>
            <br/>
            <asp:DataGrid ID="dgdProducts" HorizontalAlign="Center" Width="100%" CellSpacing="0"
                BorderWidth="0" ShowHeader="False" AllowPaging="True" PageSize="10" PagerStyle-Mode="NumericPages"
                DataKeyField="Id" AutoGenerateColumns="False" AllowSorting="True" HeaderStyle-CssClass="dg_header"
                PagerStyle-CssClass="dg_pager" FooterStyle-CssClass="dg_footer" AlternatingItemStyle-CssClass="dg_altitem"
                ItemStyle-CssClass="dg_item" CellPadding="0" runat="Server">
                <AlternatingItemStyle CssClass="dg_altitem"></AlternatingItemStyle>
                <ItemStyle CssClass="dg_item"></ItemStyle>
                <HeaderStyle CssClass="dg_header"></HeaderStyle>
                <FooterStyle CssClass="dg_footer"></FooterStyle>
                <Columns>
                    <asp:TemplateColumn>
                        <ItemTemplate>
                            <div style="border: solid 1px gray;">
                            <table style="width: 100%" border="0" cellpadding="5" cellspacing="0">
                                <tr>
                                    <td rowspan="2" style="vertical-align: middle; text-align:center; width: 70px;">
                                        <asp:ImageButton runat="server" CommandName="Select" CommandArgument='<%# Eval("ID") %>' BorderWidth="0" ID="imgProduct" CausesValidation="false" ImageUrl='<%# "App_Common/UserControls/ImageHandler.ashx?ImagePath=" + Eval("ImagePath") + "&Size=" + ThumbnailSize %>' /></div>
                                    </td>
                                    <td><asp:LinkButton ID="hlnkProduct" runat="server" CommandName="Select" CommandArgument='<%# Eval("ID") %>' Text='<%# Eval("Title") + " (" + Eval("ItemNumber") + ")" %>'></asp:LinkButton></td>
                                </tr>
                                <tr>
                                    <td><%#Eval("Description")%></td>
                                </tr>
                            </table></div>
                            <br>
                        </ItemTemplate>
                    </asp:TemplateColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" Position="TopAndBottom" CssClass="dg_pager" Mode="NumericPages">
                </PagerStyle>
            </asp:DataGrid>
        </asp:Panel>
        <asp:Panel ID="pnlSearchResults" runat="server" Visible="False">
            <h3>
                Page Search Results</h3>
            <table class="SearchStatus" id="Table1" cellspacing="1" cellpadding="1" width="100%"
                align="center" border="0">
                <tr>
                    <td style="height: 18px;">
                        Searched the site for
                        <asp:Label ID="lblSearchWords" runat="server" Font-Bold="True"></asp:Label>.&nbsp;&nbsp;&nbsp;
                        <asp:Label ID="lblFilesFound" runat="server" Font-Bold="True"></asp:Label>&nbsp;Files
                        found
                    </td>
                </tr>
            </table>
            <br/>
            <asp:DataGrid ID="dgdPages" HorizontalAlign="Center" Width="100%" CellSpacing="0"
                BorderWidth="0" ShowHeader="False" AllowPaging="True" PageSize="10" PagerStyle-Mode="NumericPages"
                DataKeyField="PageId" AutoGenerateColumns="False" AllowSorting="True" HeaderStyle-CssClass="dg_header"
                PagerStyle-CssClass="dg_pager" FooterStyle-CssClass="dg_footer" AlternatingItemStyle-CssClass="dg_altitem"
                ItemStyle-CssClass="dg_item" CellPadding="0" runat="Server" 
                onpageindexchanged="dgdPages_PageIndexChanged" 
                onsortcommand="dgdPages_SortCommand">
                <AlternatingItemStyle CssClass="dg_altitem"></AlternatingItemStyle>
                <ItemStyle CssClass="dg_item"></ItemStyle>
                <HeaderStyle CssClass="dg_header"></HeaderStyle>
                <FooterStyle CssClass="dg_footer"></FooterStyle>
                <Columns>
                    <asp:TemplateColumn>
                        <ItemTemplate>
                            <%# DisplayTitle(Eval("Title").ToString(),Eval("Path").ToString()) %>
                            <br>
                            <%# Eval("HighlightedContents")%>
                            <br>
                            <font color="dimgray">
                                <%# String.Format("{0}", DisplayPath(Eval("Path").ToString())) %>
                            </font>
                            <br>
                            <br>
                        </ItemTemplate>
                    </asp:TemplateColumn>
                </Columns>
                <PagerStyle HorizontalAlign="Right" Position="TopAndBottom" CssClass="dg_pager" Mode="NumericPages">
                </PagerStyle>
            </asp:DataGrid>
            <table class="SearchStatus" id="Table2" cellspacing="1" cellpadding="1" width="98%"
                align="center" border="0">
                <tr>
                    <td width="47%" height="18">
                        &nbsp;Searched
                        <asp:Label ID="lblTotalFiles" runat="server" Font-Bold="True"></asp:Label>&nbsp;pages
                        in total.
                    </td>
                    <td align="right" width="53%" height="18">
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
</asp:Content>